﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


using System.IO.Ports;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        static SerialClass sc = new SerialClass();

        static void sc_DataReceived(object sender, SerialDataReceivedEventArgs e, byte[] bits)
        {
            //bits为接收到的数据
        }

        private void Form1_Load(object sender, EventArgs e)
        {


            sc.DataReceived += new SerialClass.SerialPortDataReceiveEventArgs(sc_DataReceived);
            sc.writeData("at");
            Console.ReadLine();

            sc.writeData("123");

            while(true)
            {

            }
            sc.closePort();
               
        }
    }
}
